#ifndef USERORDERTESTWINDOW_H
#define USERORDERTESTWINDOW_H

#include <QBitmap>
#include <QLabel>
#include <QMainWindow>
#include <QPainter>
#include <QPixmap>

QT_BEGIN_NAMESPACE
namespace Ui {
class UserordertestWindow;
}
QT_END_NAMESPACE

class UserordertestWindow : public QMainWindow
{
    Q_OBJECT

public:
    UserordertestWindow(QWidget *parent = nullptr);
    ~UserordertestWindow();
    static void clicked();

signals:
    // 声明一个信号，用于触发 on_pushButton_5_clicked() 函数
    void pushButton5Clicked();

    // slots 部分
public slots:
    void on_pushButton_5_clicked();

private slots:

    //个人中心头像部分
    void setRoundedImage(QLabel *label, const QString &imagePath)
    {
        // 加载图片
        QPixmap pixmap(imagePath);

        // 调整图片到 QLabel 的大小
        pixmap = pixmap.scaled(label->width(),
                               label->height(),
                               Qt::KeepAspectRatioByExpanding,
                               Qt::SmoothTransformation);

        // 创建圆形遮罩
        QPixmap roundedPixmap(label->size());
        roundedPixmap.fill(Qt::transparent);

        QPainter painter(&roundedPixmap);
        painter.setRenderHint(QPainter::Antialiasing, true);
        painter.setBrush(QBrush(pixmap));
        painter.setPen(Qt::NoPen);

        // 绘制圆形
        painter.drawEllipse(0, 0, label->width(), label->height());
        // 设置边框颜色和宽度
        painter.setPen(QPen(QColor("#F3A14D"), 3)); //边框颜色
        painter.drawEllipse(0, 0, label->width(), label->height());
        painter.end();

        // 应用圆形图片
        label->setPixmap(roundedPixmap);
    }

    void on_pushButton_2_clicked();

    void on_pushButton_4_clicked();

    // void on_pushButton_5_clicked();

private:
    Ui::UserordertestWindow *ui;
};
#endif // USERORDERTESTWINDOW_H
